const mongoose = require("mongoose");
const Schema = mongoose.Schema;
//用户注册的信息
/**
 * @type {mongoose.Schema}
 * type: 收支类型
 * describe: 收支描述
 * income: 收入
 * expend: 支出
 * cash: 账户现金
 * remark: 备注
 * date: 创建时间
 */
const ProfileSchema = new Schema({
  type: {
    type: String
  },
  describe: {
    type: String
  },
  income: {
    type: String,
    required: true
  },
  expend: {
    type: String,
    required: true
  },
  cash: {
    type: String,
    required: true
  },
  remark: {
    type: String
  },
  date: {
    type: Date,
    default: Date.now()
  }
});

module.exports = Profile = mongoose.model("profile", ProfileSchema);
/** profile: 数据库里的 集合/表 名 */